import * as api from '../../api/employees';

export default {
  namespaced: true,
  state: {
    userList: [],
    total: 0,
  },
  mutations: {
    GET_USER_LIST (state, newList) {
      state.userList = newList;
    },
    GET_TOTAL (state, newTotal) {
      state.total = newTotal;
    },
  },
  actions: {
    async updateUserList (context, params) {
      const res = await api.getUserList(params);
      context.commit('GET_USER_LIST', res.rows);
      context.commit('GET_TOTAL', res.total);
    },
  },
};
